from django.http import HttpResponse
from django.shortcuts import render
from django.utils.decorators import method_decorator
from django.views import View
#导入装饰器
from app_class.decorate import my_decorator
# Create your views here.



#给所有请求添加装饰器
@method_decorator(my_decorator,name='dispatch')
#给指定的请求添加装饰器，方式2
# @method_decorator(my_decorator,name='get')
class IndexView(View):
    #给指定的请求添加装饰器，方式1
    # @method_decorator(my_decorator)
    def get(self,request):
        #处理get请求
        return HttpResponse('类视图，处理的是get请求')

# POST http://localhost:8000/appclass/indexview/
# Content-Type: application/x-www-form-urlencoded

    @method_decorator(my_decorator)
    def post(self,request):
        #处理post请求
        return HttpResponse('类视图，处理post请求')

    def put(self,request):
        return HttpResponse('类视图，处理put请求')

















